var Adv_skd=require("./Adv_skd")

var cc__decorate = __decorate;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var $2UIManager = require("UIManager");
var $2FlbDataStorageUtil = require("FlbDataStorageUtil");
var $2pvzChannel = require("pvzChannel");
var $2ExcelManager = require("ExcelManager");
var cc__decorator = cc._decorator;
var ccp_ccclass = cc__decorator.ccclass;
var ccp_property = cc__decorator.property;
var def_MinGamesUI = /* */function (_cc$Component48) {
  babel_inherits(d, _cc$Component48);
  var _super52 = babel_createSuper(d);
  function d() {
    var _this114;
    babel_classCallCheck(this, d);
    _this114 = _super52.apply(this, arguments);
    _this114.close = null;
    _this114.g1 = null;
    _this114.g2 = null;
    _this114.video1 = null;
    _this114.video2 = null;
    _this114.loadingMask = null;
    _this114.progress = null;
    return _this114;
  }
  babel_createClass(d, [{
    key: "start",
    value: function start() {
       Adv_skd.default.instance.hideAllAdv();
            Adv_skd.default.instance.showInterstitialAd();
            Adv_skd.default.instance.showGridAdRight();
            Adv_skd.default.instance.showGridAdLeft();

      $2FlbDataStorageUtil.DataStorageUtil.getVal("jjdf", false) && (this.video1.active = false);
      $2FlbDataStorageUtil.DataStorageUtil.getVal("dfbwz", false) && (this.video2.active = false);
      this.close.on(cc.Node.EventType.TOUCH_END, this.on_close, this);
      this.g1.on(cc.Node.EventType.TOUCH_END, this.on_jjdf, this);
      this.g2.on(cc.Node.EventType.TOUCH_END, this.on_dfbwz, this);
      this.loadingMask.active = false;
    }
  }, {
    key: "on_dfbwz",
    value: function on_dfbwz() {
      var _this115 = this;
      if ($2FlbDataStorageUtil.DataStorageUtil.getVal("dfbwz", false)) {
        this.loadingMask.active = true;
        return void cc.assetManager.loadBundle("Dfbwzh", function (e, t) {
          if (e) {
            console.error("Dfbwzh加载失败", e);
          } else {
            t.loadDir("./", cc.Prefab, function (e, t) {
              var a = e / t;
              _this115.progress.progress = a;
            }, function () {
              t.load("bwzdaifu", cc.TextAsset, function (e, a) {
                $2ExcelManager.ExcelMgr.instance.AddExcelTable($2ExcelManager.TableName.bwzdaifuTable, a.text);
                t.load("bwzjs", cc.TextAsset, function (e, a) {
                  $2ExcelManager.ExcelMgr.instance.AddExcelTable($2ExcelManager.TableName.bwzjsTable, a.text);
                  t.load("DfbwzhUI", cc.Prefab, function (e, t) {
                    if (e) {
                      console.error("DfbwzhUI加载失败", e);
                      return void (_this115.loadingMask.active = false);
                    }
                    cc.instantiate(t).parent = _this115.node.parent;
                    _this115.loadingMask.active = false;
                    _this115.node.active = false;
                  });
                });
              });
            });
          }
        });
      }
      $2pvzChannel.pvzChannel.instance().showVideo({
        sucCall() {
          $2FlbDataStorageUtil.DataStorageUtil.setVal("dfbwz", true);
          _this115.video2.active = false;
        },
        failCall() {},
        endCall() {}
      });
    }
  }, {
    key: "on_jjdf",
    value: function on_jjdf() {
      var _this116 = this;
      if ($2FlbDataStorageUtil.DataStorageUtil.getVal("jjdf", false)) {
        this.loadingMask.active = true;
        var _e59 = this;
        cc.assetManager.loadBundle("Jiujiudaifu", function (t, a) {
          if (t) {
            console.error("Jiujiudaifu加载失败", t);
          } else {
            a.loadDir("./", cc.Prefab, function (t, a) {
              var n = t / a;
              _e59.progress.progress = n;
            }, function () {
              a.load("time", cc.TextAsset, function (t, n) {
                $2ExcelManager.ExcelMgr.instance.AddExcelTable($2ExcelManager.TableName.timeTable, n.text);
                a.load("JiujiudaifuUI", cc.Prefab, function (t, a) {
                  if (t) {
                    console.error("JiujiudaifuUI加载失败", t);
                    return void (_e59.loadingMask.active = false);
                  }
                  cc.instantiate(a).parent = _e59.node.parent;
                  _e59.loadingMask.active = false;
                  _e59.node.active = false;
                });
              });
            });
          }
        });
      } else {
        $2pvzChannel.pvzChannel.instance().showVideo({
          sucCall() {
            $2FlbDataStorageUtil.DataStorageUtil.setVal("jjdf", true);
            _this116.video1.active = false;
          },
          failCall() {},
          endCall() {}
        });
      }
    }
  }, {
    key: "on_close",
    value: function on_close() {
      Adv_skd.default.instance.hideAllAdv();

      $2UIManager.default.instance.closeUI("MinGamesUI");
    }
  }]);
  return d;
}(cc.Component);
cc__decorate([ccp_property(cc.Node)], def_MinGamesUI.prototype, "close", undefined);
cc__decorate([ccp_property(cc.Node)], def_MinGamesUI.prototype, "g1", undefined);
cc__decorate([ccp_property(cc.Node)], def_MinGamesUI.prototype, "g2", undefined);
cc__decorate([ccp_property(cc.Node)], def_MinGamesUI.prototype, "video1", undefined);
cc__decorate([ccp_property(cc.Node)], def_MinGamesUI.prototype, "video2", undefined);
cc__decorate([ccp_property(cc.Node)], def_MinGamesUI.prototype, "loadingMask", undefined);
cc__decorate([ccp_property(cc.ProgressBar)], def_MinGamesUI.prototype, "progress", undefined);
def_MinGamesUI = cc__decorate([ccp_ccclass], def_MinGamesUI);
exports.default = def_MinGamesUI;